package com.jysz.certificate.persistence.model.pm;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.jysz.certificate.persistence.model.system.Organization;
import com.jysz.certificate.persistence.model.system.Shop;
import com.jysz.certificate.persistence.model.system.User;
import com.jysz.webcore.ssh.entity.AbstractBaseEntity;

@Entity
@Table(name = "pm_user_list_")
@org.hibernate.annotations.Entity
public class PmUserList  extends AbstractBaseEntity<Long>  {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Shop shop;//店
	private List<User> users;//人
	private PmUser pmUser;
	private Organization organization;//关联的组织架构
	
	@ManyToOne(fetch = FetchType.LAZY)  
	@JoinColumn(name = "_organization_id",columnDefinition="bigint(20)") 
	public Organization getOrganization() {
		return organization;
	}
	public void setOrganization(Organization organization) {
		this.organization = organization;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)  
	@JoinColumn(name = "_pm_user_id",columnDefinition="bigint(20)") 
	public PmUser getPmUser() {
		return pmUser;
	}
	public void setPmUser(PmUser pmUser) {
		this.pmUser = pmUser;
	}
	@ManyToOne(fetch = FetchType.LAZY)  
	@JoinColumn(name = "_shop_id",columnDefinition="bigint(20)") 
	public Shop getShop() {
		return shop;
	}
	public void setShop(Shop shop) {
		this.shop = shop;
	}
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "rs_user_list__sys_user_", joinColumns = @JoinColumn(name = "_user_list_id"), inverseJoinColumns = @JoinColumn(name = "_user_id"))
	public List<User> getUsers() {
		return users;
	}
	public void setUsers(List<User> users) {
		this.users = users;
	}
	
	

}
